<?php

/**
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: dzapp_base.php 33234 2016-06-21 15:51:25Z mpage $
 */

if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}

if(submitcheck('listsubmit')) {

	if(is_array($_GET['delete'])) {
		C::t('#dzapp_base#dzapp_base_jssdk')->delete($_GET['delete']);
	}

	if(is_array($_GET['module'])) {
		foreach($_GET['module'] as $key => $value) {
			C::t('#dzapp_base#dzapp_base_jssdk')->update($key, array(
				'displayorder' => $_GET['displayorder'][$key],
				'module' => $_GET['module'][$key],
				'title' => $_GET['title'][$key],
				'img' => $_GET['img'][$key],
				'desc' => $_GET['desc'][$key],
				'available' => $_GET['available'][$key],
			));
		}
	}

	if(is_array($_GET['newmodule'])) {
		foreach($_GET['newmodule'] as $key => $value) {
			if(empty($value)) continue;
			C::t('#dzapp_base#dzapp_base_jssdk')->insert(array(
				'displayorder' => $_GET['newdisplayorder'][$key],
				'module' => $_GET['newmodule'][$key],
				'title' => $_GET['newtitle'][$key],
				'img' => $_GET['newimg'][$key],
				'desc' => $_GET['newdesc'][$key],
				'available' => $_GET['newavailable'][$key],
			));
		}
	}

	require_once libfile('function/cache');
	updatecache('dzapp_base:dzapp_base_jssdk');

	showmessage('operation_done', 'plugin.php?id=dzapp_base&mod=basecp&ac=jssdk');
}

$list = C::t('#dzapp_base#dzapp_base_jssdk')->fetch_all_by_search(array(), 0, 0, 'displayorder', 'ASC', 'jssdk_id');

include_once template("dzapp_base:basecp_jssdk");

?>